package com.menu.model;

import lombok.Data;

import java.util.Date;
import java.util.UUID;

/**
 * author: MaHX
 * date: 2019/8/8/19:27
 * description:
 **/
@Data
public class BaseModel {
    protected String id;
    protected int delFlag;
    protected Date updateTime;

    /**
     * 更新前进行时间更新
     */
    public void preUpdate(){
        this.updateTime = new Date();
    }

    /**
     * 插入前进行id赋值且更新时间
     */
    public void preInsert(){
        this.id = UUID.randomUUID().toString().replaceAll("-","");
        this.updateTime = new Date();
    }
}
